var rules_basic = {
  condition: 'OR',
  rules: [
      {
        id: 'category',
        operator: 'not_equal',
        values: 'Music'
      }
    ]
};

$('#builder-widgets').queryBuilder({
  plugins: ['bt-tooltip-errors'],
  
  filters: [
       {
            id: 'category',
            label: '媒体选择',
            type: 'integer',
            input: 'select',
            values: {
              1: '360',
              2: '神马',
              3: '百度',
              4: '搜狗'
            },
            operators: ['equal', 'not_equal', 'in', 'not_in', 'is_null', 'is_not_null']
       },
       {
            id: 'tglx',
            label: '推广类型',
            type: 'integer',
            input: 'select',
            values: {
              1: '搜索引擎',
              2: '网络广告'
            },
            operators: ['equal', 'not_equal', 'in', 'not_in', 'is_null', 'is_not_null']
       },
       {
            id: 'asd',
            label: '选择账户',
            type: 'integer',
            input: 'select',
            values: {
              1: '360账户',
              2: '神马账户',
              3: '百度账户',
              4: '搜狗账户'
            },
            operators: ['equal', 'not_equal', 'in', 'not_in', 'is_null', 'is_not_null']
       }
  ],
  rules: rules_basic
});

// $('#btn-reset').on('click', function() {
//   $('#builder-widgets').queryBuilder('reset');
// });

// $('#btn-set').on('click', function() {
//   $('#builder-widgets').queryBuilder('setRules', rules_basic);
// });

$('#btn-get').on('click', function() {
    // alert('123')
  var result = $('#builder-widgets').queryBuilder('getRules');
  if (!$.isEmptyObject(result)) {
    alert(JSON.stringify(result, null, 2));
  }
});